// index.ts
// 获取应用实例
const app = getApp<IAppOption>()
const apiIndex = require('../../api/request')
// pages/home/home.ts
// pages/home/home.ts


Component({
  data: {
    arr:[]
  },
  methods: {
    async categorygetFn(){
      const content:any = await apiIndex.categoryget()
      // console.log(content)
      if(content.code == 200){
        this.setData({
          arr:content.content
        })
        // console.log(this.arr)
      }
      // let {code:numner,result:any} = content

    },
    jumpcategoryFn(event:any){
      if (event && event.currentTarget) {
        let category_id = event.currentTarget.dataset.category_id;
        wx.navigateTo({
          url:'../category/category?category_id='+category_id
        })
      } 
      else {
        console.error("没有此路由id！");
      }
    }
  },
  created(){
    this.categorygetFn()
  }
})
